/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package classes;

/**
 *
 * @author ANTONIO
 */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class ConnectionDB {
    public ConnectionDB(){}
    
    public Connection createConnection(){
        Connection con = null;
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            String connectionUrl = "jdbc:sqlserver://147.91.42.38:1433;" +
            "databaseName=DbQA;user=sa;password=123456;";
            con = DriverManager.getConnection(connectionUrl);
         } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+ cE.toString());
        }
        return con;
    }
    
    public void closeConnection(Connection con){
        try {
            con.close();
        } catch (SQLException ex) {
            System.out.println("Impossible to close connection");
        }
    }

}
